package cn.zhaoyuening.zamh.example;

import cn.zhaoyuening.zamh.handler.MsgHandler;
import cn.zhaoyuening.zamh.manager.MsgManager;
import cn.zhaoyuening.zamh.manager.MsgManagers;
import cn.zhaoyuening.zamh.msg.Msg;

/**
 * Created by 赵岳宁 on 2017/6/3.
 */
public class Demo {
    private static final int MSG_A = 1;
    private static final int MSG_B = 2;
    private static final int MSG_C = 3;
    public static void main(String[] args) throws InterruptedException {

        MsgManager manager = MsgManagers.getBaseMsgManager();
        manager.addHandler(new MsgHandler(MSG_A) {
            @Override
            public void handle(Msg msg) {
                System.out.println(msg);
            }
        });
        Thread.sleep(1000);
        manager.sendMsg(new Msg(MSG_A,"TEST CONTENT!"));
        Thread.sleep(1000);
        manager.sendMsg(new Msg(MSG_B,"TEST CONTENT2!"));
        Thread.sleep(1000);
        manager.sendMsg(new Msg(MSG_A,"TEST CONTENT3!"));
    }
}
